<h1>View Users</h1>

<? if($message) { echo '<span class="page_error">'.$message.'</span>'; } ?>

<p>Below is the list of all users registered in this application.</p>

<h2 id="search_title" onclick="toggle_searchbox()" style="cursor: pointer">+ Search For Users</h2>
<div id="searchbox" style="display: none">
	<form method="post" action="admin/view_users">
	<p><label for="user_id">User ID:</label><input type="text" name="user_id" size="7"/></p>
	<p><label for="email">Email:</label><input type="text" name="email" size="30"/></p>
	<p><label for="first_name">First Name:</label><input type="text" name="first_name" size="25"/></p>
	<p><label for="last_name">Last Name:</label><input type="text" name="last_name" size="25"/></p>
	<p><label for="creation_date">Creation Date:</label>From <input type="text" name="date_from" size="15"/> To <input type="text" name="date_to" size="15"/></p>
	<p><label for="submit_search"><input type="submit" value="Search" /></label></p>
	</form>
	<br /><br />
</div>

<h2 id="users_title" onclick="toggle_users()" style="cursor: pointer">- Users</h2>
<table id="hor-minimalist-b" style="width: 900px">
	<tr>
		<!-- <th><input type="checkbox" name="select_all" id="select_all" onclick="toggle_checkboxes(<?=count($users)?>)" /></th> -->
		<th>ID</th>
		<th>Email</th>
		<th>Name</th>
		<th>Account Type</th>
		<th>Last Login</th>
		<th>Status</th>
		<th>&nbsp;</th>
	</tr>
	<? $i = 0; foreach($users as $u) { ?>
	<tr>
		<!-- <td><input type="checkbox" name="user[]" id="user_<?=$i?>" value="<?=$u->id?>" /></td> -->
		<td onclick="toggle_user_checkbox('user_<?=$i?>')"><?=$u->id?></td>
		<td onclick="toggle_user_checkbox('user_<?=$i?>')"><a href="<?=base_url()?>users/edit/<?=$u->id?>"><?=$u->email?></a></td>
		<td onclick="toggle_user_checkbox('user_<?=$i?>')"><?=$u->first_name?> <?=$u->last_name?></td>
		<td onclick="toggle_user_checkbox('user_<?=$i?>')"><?=$u->account_type?></td>
		<td onclick="toggle_user_checkbox('user_<?=$i?>')"><?=unix_to_user($u->last_login,$u->timezone)?></td>
		<td onclick="toggle_user_checkbox('user_<?=$i?>')"><?=$u->status?></td>
		<td onclick="toggle_user_checkbox('user_<?=$i?>')"><?=$u->ban_link?> | <a onClick="return confirm('Are you sure you want to delete?')" href="<?=base_url()?>users/delete/<?=$u->id?>">Delete</a></td>
	</tr>
	<? $i++; } ?>
</table>
<?=$pagination_links?>